function [Psai lossvec no_constraints] = calConstraintsPrimal(S)

m = size(S,2);
no_constraints = 0;
for i=1:m
   if (~isempty(S(i).yhat)) 
   Psai(i,:) = S(i).x_feat{end};
   lossvec(i,:) = S(i).loss_yhat(end);   
   end
end
no_constraints = min(m,size(Psai,1));
